package dvonn.ai;

import java.util.ArrayList;
import java.util.Iterator;

import dvonn.game.Move;

public class DvonnTree {
	
	private DvonnTree parent;
	private ArrayList<DvonnTree> childs;
	private Iterator<DvonnTree> iterator;
	private int value=0;
	private boolean valueIsInited;
	private Move move;
	
	public DvonnTree(DvonnTree theParent) {
		this.parent = theParent;
		this.childs = new ArrayList<DvonnTree>();
		this.iterator = childs.iterator();
		this.valueIsInited = false;
	}
	
	public DvonnTree getParent() {
		return this.parent;
	}
	
	public DvonnTree getNextChild() {
		if (this.iterator.hasNext()) return this.iterator.next();
		return null;
	}
	
	public ArrayList<DvonnTree> gettAllChilds() {
		return this.childs;
	}
	
	public void addChild(DvonnTree child) {
		this.childs.add(child);
	}
	
	public int getValue() {
		return this.value;
	}
	
	public boolean valueInited() {
		return this.valueIsInited;
	}
	
	public void setValue(int v) {
		this.value = v;
		this.valueIsInited = true;
	}
	
	public Move getMove() {
		return this.move;
	}

	public void setMove(Move m) {
		this.move = m;
	}
}
